package com.softserveinc.ita.kaiji.model.game;

import com.softserveinc.ita.kaiji.model.*;
import com.softserveinc.ita.kaiji.model.player.Player;
import com.softserveinc.ita.kaiji.model.util.Identifiable;

import java.util.List;
import java.util.Map;

/**
 * Immutable history of the game.
 * Includes <code>GameInfo</code>, full list of rounds, statistic of the game and winners
 * Game build his interface instances
 * @see com.softserveinc.ita.kaiji.model.game.Game
 * @author Paziy Evgeniy
 * @version 1.7
 * @since 17.03.14
 */
public interface GameHistory extends Identifiable {

    /**
     * Method returns game info which history belongs.
     * @return game info which history belongs.
     */
    GameInfo getGameInfo();

    /**
     * Returns list of results for rounds which already ended.
     * @return list of results for rounds which already ended.
     */
    List<RoundResult> getRoundResults();

    /**
     * Returns <code>RoundResult</code> for last played round in game.
     * Can return <code>null</code> if there are no finished rounds
     * @return last round result
     */
    RoundResult getLastRoundResult();

    /**
     * Returns player who leading in game or winner if game is finished.
     * Can return <code>null</code> if for current moment draw.
     * @return player who leading in game or winner if game is finished
     */
    //todo must return set of players
    Player getWinner();

    /**
     * Returns statistic for chosen player.
     * You can get count of round which finished with chosen result.
     * <code>getStatisticFor(player).get(Card.DuelResult.WIN)</code>
     * will return count of wined rounds for player.
     * @param player for whom statistic will return
     * @return statistic for chosen player
     */
    Map<Card.DuelResult, Integer> getStatisticFor(Player player);

    /**
     * Returns current status of the game
     * @return current status of the game
     */
    Game.State getGameStatus();

}
